package view;

import java.awt.BorderLayout;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

import javax.swing.BorderFactory;
import javax.swing.JLabel;
import javax.swing.JPanel;

import controller.KundenController;

public class LastView extends JPanel implements PropertyChangeListener {

	private JLabel jLabel;

	public LastView(KundenController controller) {
		super();
		setBorder(BorderFactory.createTitledBorder("Letzter Kunde"));
		controller.getKundenModel().addPropertyChangeListener(this);
		jLabel = new JLabel();
		add(jLabel, BorderLayout.CENTER);
	}

	@Override
	public void propertyChange(PropertyChangeEvent evt) {
		if (evt.getPropertyName().equals("KUNDE_ADD")) {
			jLabel.setText(evt.getNewValue().toString());
		}

	}
}
